package com.fh.common;

import com.fh.enums.ResultEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultMassage {
    private Integer code;//返回值
    private String msg;//信息
    private Object data;//返回数据

    //请求成功，只有提示信息
    public static ResultMassage result(ResultEnum resultEnum) {
        return new ResultMassage(resultEnum.getCode(), resultEnum.getMsg(), null);
    }


    //请求成功，只有提示信息
    public static ResultMassage success(String msg) {
        return new ResultMassage(0, msg, null);
    }

    //请求成功，只有提示信息
    public static ResultMassage result(ResultEnum resultEnum, Object data) {
        return new ResultMassage(resultEnum.getCode(), resultEnum.getMsg(), data);
    }
}
